package com.flydust.apipulse.service;

import com.flydust.apipulse.entity.Directory;
import com.flydust.apipulse.repository.DirectoryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class DirectoryService {

    @Autowired
    private DirectoryRepository directoryRepository;

    public List<Directory> findByProjectId(Long projectId) {
        return directoryRepository.findByProjectId(projectId);
    }

    public Directory save(Directory directory) {
        return directoryRepository.save(directory);
    }

    public Optional<Directory> findById(Long id) {
        return directoryRepository.findById(id);
    }

    public void deleteById(Long id) {
        directoryRepository.deleteById(id);
    }

    public List<Directory> findAll() {
        return directoryRepository.findAll();
    }
}